// Package webmanage @author <chengjiang@buffalo-robot.com>
// @date 2023/2/27
// @note
package webmanage

import (
	"context"
	"github.com/go-kratos/kratos/v2/log"
	"gorm.io/gorm"
	"phm/models/generator/model"
)

type SysMessageRepo interface {
	CreateSysMessage(ctx context.Context, uModel *model.SysMessage, db *gorm.DB) error
	UpdateSysMessage(ctx context.Context, uModel *model.SysMessage, db *gorm.DB) error
	DeleteSysMessageByIds(ctx context.Context, ids []string, db *gorm.DB) error
	GetSysMessageById(ctx context.Context, id string) (*model.SysMessage, error)
	GetSysMessageByIds(ctx context.Context, ids []string) ([]*model.SysMessage, error)
	// GetDB 得到db以方便事务处理
	GetDB() *gorm.DB
}

type SysMessageUseCase struct {
	sysmsg SysMessageRepo
	log    *log.Helper
}

func NewSysMessageUseCase(sysmsg SysMessageRepo, logger log.Logger) *SysMessageUseCase {
	return &SysMessageUseCase{
		sysmsg: sysmsg,
		log:    log.NewHelper(logger),
	}
}
